package cn.edu.bzu.group4.stockplus.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cn.edu.bzu.group4.stockplus.utils.JuheNews;

@Controller
@RequestMapping(value="/")
public class IndexController {
	ModelAndView modelandview = null;
	
	
	@RequestMapping(method={RequestMethod.GET})
	public ModelAndView index(HttpSession newssession){
/*		if(newssession.getAttribute("news") == null){
			JuheNews.searchNews("股市");
			//newssession.setAttribute("news", value);
		}*/
		
		modelandview = new ModelAndView("index");
		modelandview.addObject("title","首页");
		return modelandview;
	}
	
	@RequestMapping(value="/index",method={RequestMethod.GET})
	public ModelAndView toindex(){
		ModelAndView mv = new ModelAndView("index");
		mv.addObject("title","首页");
		return mv;
	}
	
	
	@RequestMapping(value="/news",method={RequestMethod.GET})
	public ModelAndView header(){
		ModelAndView mv = new ModelAndView("news");
		mv.addObject("title","新闻");
		return mv;
	}
	
	
	@RequestMapping(value="/stock",method={RequestMethod.GET})
	public ModelAndView stock(){
		ModelAndView mv = new ModelAndView("stock");
		mv.addObject("title", "股票");
		return mv;
	}
	
	@RequestMapping(value="/about",method={RequestMethod.GET})
	public ModelAndView about(){
		ModelAndView mv = new ModelAndView("about");
		mv.addObject("title", "关于");
		return mv;
	}
	
	
	@RequestMapping(value="/404",method={RequestMethod.GET})
	public ModelAndView errorpage404(){
		ModelAndView mv = new ModelAndView("404");
		mv.addObject("title","404");
		return mv;
	}
}
